package com.eastfair.certificate.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.certificate.enumeration.CertificateOrderDrawTypeEnum;
import com.eastfair.certificate.enumeration.CertificateOrderReturnTypeEnum;
import com.eastfair.certificate.enumeration.CertificateOrderOrderStatusEnum;
import com.eastfair.certificate.enumeration.CertificateOrderAuthReturnStatusEnum;
import com.eastfair.certificate.enumeration.CertificateOrderCertificateTypeEnum;
import com.eastfair.certificate.enumeration.CertificateOrderReturnOrderStatusEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 制证订单
 * </p>
 *
 * @author ligang
 * @since 2023-07-07
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("cert_certificate_order")
@ApiModel(value = "CertificateOrder", description = "制证订单")
@AllArgsConstructor
public class CertificateOrder extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 订单码
     */
    @ApiModelProperty(value = "订单码")
    @Size(max = 255, message = "订单码长度不能超过255")
    @TableField(value = "order_number", condition = LIKE)
    @Excel(name = "订单码")
    private String orderNumber;

    /**
     * 证件费
     */
    @ApiModelProperty(value = "证件费")
    @TableField(value = "cost_money")
    @Excel(name = "证件费")
    private BigDecimal costMoney;

    /**
     * 超时费
     */
    @ApiModelProperty(value = "超时费")
    @TableField(value = "over_time_money")
    @Excel(name = "超时费")
    private BigDecimal overTimeMoney;

    /**
     * 押金
     */
    @ApiModelProperty(value = "押金")
    @TableField(value = "deposit_money")
    @Excel(name = "押金")
    private BigDecimal depositMoney;

    /**
     * 实际支付金额
     */
    @ApiModelProperty(value = "实际支付金额")
    @TableField(value = "order_money")
    @Excel(name = "实际支付金额")
    private BigDecimal orderMoney;

    /**
     * 退款金
     */
    @ApiModelProperty(value = "退款金")
    @TableField(value = "return_money")
    @Excel(name = "退款金")
    private BigDecimal returnMoney;

    /**
     * 退款方式:#{ONLINE:线上退款;OFFLINE:线下;}
     */
    @ApiModelProperty(value = "退款方式:#{ONLINE:线上退款;OFFLINE:线下;}")
    @TableField(value = "return_type")
    @Excel(name = "退款方式:#{ONLINE:线上退款;OFFLINE:线下;}", replace = {"线上退款_ONLINE", "线下_OFFLINE",  "_null"})
    private CertificateOrderReturnTypeEnum returnType;

    /**
     * 凭证号
     */
    @ApiModelProperty(value = "凭证号")
    @Size(max = 256, message = "凭证号长度不能超过256")
    @TableField(value = "voucher_number", condition = LIKE)
    @Excel(name = "凭证号")
    private String voucherNumber;

    /**
     * 退款理由
     */
    @ApiModelProperty(value = "退款理由")
    @Size(max = 256, message = "退款理由长度不能超过256")
    @TableField(value = "return_label", condition = LIKE)
    @Excel(name = "退款理由")
    private String returnLabel;

    /**
     * 展会ID
     */
    @ApiModelProperty(value = "展会ID")
    @TableField(value = "exhibition_id")
    @Excel(name = "展会ID")
    private Long exhibitionId;

    /**
     *  主体类型  主运，搭建商，参展商
     */
    @ApiModelProperty(value = " 主体类型  主运，搭建商，参展商")
    @Size(max = 255, message = " 主体类型  主运，搭建商，参展商长度不能超过255")
    @TableField(value = "principal_type", condition = LIKE)
    @Excel(name = " 主体类型  主运，搭建商，参展商")
    private String principalType;

    /**
     * 公司id
     */
    @ApiModelProperty(value = "公司id")
    @TableField(value = "company_id")
    @Excel(name = "公司id")
    private Long companyId;

    /**
     * 是否领取
     */
    @ApiModelProperty(value = "是否领取")
    @TableField(value = "is_draw")
    @Excel(name = "是否领取")
    private Integer isDraw;

    /**
     * 是否开取发票
     */
    @ApiModelProperty(value = "是否开取发票")
    @TableField(value = "is_take")
    @Excel(name = "是否开取发票")
    private Integer isTake;

    /**
     * 是否支付
     */
    @ApiModelProperty(value = "是否支付")
    @TableField(value = "is_pay")
    @Excel(name = "是否支付")
    private Integer isPay;

    /**
     * 是否打印小票
     */
    @ApiModelProperty(value = "是否打印小票")
    @TableField(value = "is_print_take_node")
    @Excel(name = "是否打印小票")
    private Integer isPrintTakeNode;

    /**
     * 是否打印
     */
    @ApiModelProperty(value = "是否打印")
    @TableField(value = "is_print_take")
    @Excel(name = "是否打印")
    private Integer isPrintTake;

    /**
     * 订单状态:#{NO_PAY:未支付;WAIT:支付中;PAY_FAIL:支付失败;PAY_SUCC:支付成功;}
     */
    @ApiModelProperty(value = "订单状态:#{NO_PAY:未支付;WAIT:支付中;PAY_FAIL:支付失败;PAY_SUCC:支付成功;}")
    @TableField(value = "order_status")
    @Excel(name = "订单状态:#{NO_PAY:未支付;WAIT:支付中;PAY_FAIL:支付失败;PAY_SUCC:支付成功;}", replace = {"未支付_NO_PAY", "支付中_WAIT", "支付失败_PAY_FAIL", "支付成功_PAY_SUCC",  "_null"})
    private CertificateOrderOrderStatusEnum orderStatus;

    /**
     * 是否取消
     */
    @ApiModelProperty(value = "是否取消")
    @TableField(value = "is_cancel")
    @Excel(name = "是否取消")
    private Integer isCancel;

    /**
     * 退单状态:#{REFUND:退款中;NO_REFUND:未退款;YES_REFUND:已退款;}
     */
    @ApiModelProperty(value = "退单状态:#{REFUND:退款中;NO_REFUND:未退款;YES_REFUND:已退款;}")
    @TableField(value = "return_order_status")
    @Excel(name = "退单状态:#{REFUND:退款中;NO_REFUND:未退款;YES_REFUND:已退款;}", replace = {"退款中_REFUND", "未退款_NO_REFUND", "已退款_YES_REFUND",  "_null"})
    private CertificateOrderReturnOrderStatusEnum returnOrderStatus;

    /**
     * 退款状态:#{AUTH:审核中;AUTH_SUCESS:审核成功;AUTH_FAIL:审核失败;}
     */
    @ApiModelProperty(value = "退款状态:#{AUTH:审核中;AUTH_SUCESS:审核成功;AUTH_FAIL:审核失败;}")
    @TableField(value = "auth_return_status")
    @Excel(name = "退款状态:#{AUTH:审核中;AUTH_SUCESS:审核成功;AUTH_FAIL:审核失败;}", replace = {"审核中_AUTH", "审核成功_AUTH_SUCESS", "审核失败_AUTH_FAIL",  "_null"})
    private CertificateOrderAuthReturnStatusEnum authReturnStatus;

    /**
     * 是否是退款订单
     */
    @ApiModelProperty(value = "是否是退款订单")
    @TableField(value = "is_return")
    @Excel(name = "是否是退款订单")
    private Integer isReturn;

    /**
     * 是否可用，1是；0否
     */
    @ApiModelProperty(value = "是否可用，1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否可用，1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 证件类型:#{CAR:车证;PEOPLE:人证;POWER:机力车证;OTHER:其他证;}
     */
    @ApiModelProperty(value = "证件类型:#{CAR:车证;PEOPLE:人证;POWER:机力车证;OTHER:其他证;}")
    @TableField(value = "certificate_type")
    @Excel(name = "证件类型:#{CAR:车证;PEOPLE:人证;POWER:机力车证;OTHER:其他证;}", replace = {"车证_CAR", "人证_PEOPLE", "机力车证_POWER", "其他证_OTHER",  "_null"})
    private CertificateOrderCertificateTypeEnum certificateType;

    /**
     * 领取人姓名
     */
    @ApiModelProperty(value = "领取人姓名")
    @Size(max = 255, message = "领取人姓名长度不能超过255")
    @TableField(value = "draw_name", condition = LIKE)
    @Excel(name = "领取人姓名")
    private String drawName;

    /**
     * 领取人手机号
     */
    @ApiModelProperty(value = "领取人手机号")
    @Size(max = 255, message = "领取人手机号长度不能超过255")
    @TableField(value = "draw_mobile", condition = LIKE)
    @Excel(name = "领取人手机号")
    private String drawMobile;

    /**
     * 领取人身份证号
     */
    @ApiModelProperty(value = "领取人身份证号")
    @Size(max = 255, message = "领取人身份证号长度不能超过255")
    @TableField(value = "draw_idcard", condition = LIKE)
    @Excel(name = "领取人身份证号")
    private String drawIdcard;

    /**
     * 领取单号
     */
    @ApiModelProperty(value = "领取单号")
    @Size(max = 255, message = "领取单号长度不能超过255")
    @TableField(value = "draw_number", condition = LIKE)
    @Excel(name = "领取单号")
    private String drawNumber;

    /**
     * 领取方式:#{MAKE:预约领取;SITE:现场领取;}
     */
    @ApiModelProperty(value = "领取方式:#{MAKE:预约领取;SITE:现场领取;}")
    @TableField(value = "draw_type")
    @Excel(name = "领取方式:#{MAKE:预约领取;SITE:现场领取;}", replace = {"预约领取_MAKE", "现场领取_SITE",  "_null"})
    private CertificateOrderDrawTypeEnum drawType;

    /**
     * 领取时间
     */
    @ApiModelProperty(value = "领取时间")
    @TableField(value = "draw_time")
    @Excel(name = "领取时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime drawTime;

    /**
     * 实际领取单号
     */
    @ApiModelProperty(value = "实际领取单号")
    @Size(max = 255, message = "实际领取单号长度不能超过255")
    @TableField(value = "draw_number_end", condition = LIKE)
    @Excel(name = "实际领取单号")
    private String drawNumberEnd;

    /**
     * 实际领取人手机号
     */
    @ApiModelProperty(value = "实际领取人手机号")
    @Size(max = 255, message = "实际领取人手机号长度不能超过255")
    @TableField(value = "draw_mobile_end", condition = LIKE)
    @Excel(name = "实际领取人手机号")
    private String drawMobileEnd;

    /**
     * 实际领取人身份证号
     */
    @ApiModelProperty(value = "实际领取人身份证号")
    @Size(max = 255, message = "实际领取人身份证号长度不能超过255")
    @TableField(value = "draw_idcard_end", condition = LIKE)
    @Excel(name = "实际领取人身份证号")
    private String drawIdcardEnd;

    /**
     * 实际领取人姓名
     */
    @ApiModelProperty(value = "实际领取人姓名")
    @Size(max = 255, message = "实际领取人姓名长度不能超过255")
    @TableField(value = "draw_name_end", condition = LIKE)
    @Excel(name = "实际领取人姓名")
    private String drawNameEnd;

    /**
     * 制证数量
     */
    @ApiModelProperty(value = "制证数量")
    @TableField(value = "certificate_num")
    @Excel(name = "制证数量")
    private Integer certificateNum;

    /**
     * 领取预约时间
     */
    @ApiModelProperty(value = "领取预约时间")
    @TableField(value = "draw_make_time")
    @Excel(name = "领取预约时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime drawMakeTime;

    /**
     * 团队id
     */
    @ApiModelProperty(value = "团队id")
    @TableField(value = "team_id")
    @Excel(name = "团队id")
    private Long teamId;


    @Builder
    public CertificateOrder(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    String orderNumber, BigDecimal costMoney, BigDecimal overTimeMoney, BigDecimal depositMoney, BigDecimal orderMoney, 
                    BigDecimal returnMoney, CertificateOrderReturnTypeEnum returnType, String voucherNumber, String returnLabel, Long exhibitionId, String principalType, 
                    Long companyId, Integer isDraw, Integer isTake, Integer isPay, Integer isPrintTakeNode, Integer isPrintTake, 
                    CertificateOrderOrderStatusEnum orderStatus, Integer isCancel, CertificateOrderReturnOrderStatusEnum returnOrderStatus, CertificateOrderAuthReturnStatusEnum authReturnStatus, Integer isReturn, Integer isEnabled, 
                    Integer isDeleted, Long tenantId, Long projectId, Long subsystemId, CertificateOrderCertificateTypeEnum certificateType, String drawName, 
                    String drawMobile, String drawIdcard, String drawNumber, CertificateOrderDrawTypeEnum drawType, LocalDateTime drawTime, String drawNumberEnd, 
                    String drawMobileEnd, String drawIdcardEnd, String drawNameEnd, Integer certificateNum, LocalDateTime drawMakeTime, Long teamId) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.orderNumber = orderNumber;
        this.costMoney = costMoney;
        this.overTimeMoney = overTimeMoney;
        this.depositMoney = depositMoney;
        this.orderMoney = orderMoney;
        this.returnMoney = returnMoney;
        this.returnType = returnType;
        this.voucherNumber = voucherNumber;
        this.returnLabel = returnLabel;
        this.exhibitionId = exhibitionId;
        this.principalType = principalType;
        this.companyId = companyId;
        this.isDraw = isDraw;
        this.isTake = isTake;
        this.isPay = isPay;
        this.isPrintTakeNode = isPrintTakeNode;
        this.isPrintTake = isPrintTake;
        this.orderStatus = orderStatus;
        this.isCancel = isCancel;
        this.returnOrderStatus = returnOrderStatus;
        this.authReturnStatus = authReturnStatus;
        this.isReturn = isReturn;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.tenantId = tenantId;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.certificateType = certificateType;
        this.drawName = drawName;
        this.drawMobile = drawMobile;
        this.drawIdcard = drawIdcard;
        this.drawNumber = drawNumber;
        this.drawType = drawType;
        this.drawTime = drawTime;
        this.drawNumberEnd = drawNumberEnd;
        this.drawMobileEnd = drawMobileEnd;
        this.drawIdcardEnd = drawIdcardEnd;
        this.drawNameEnd = drawNameEnd;
        this.certificateNum = certificateNum;
        this.drawMakeTime = drawMakeTime;
        this.teamId = teamId;
    }

}
